package com.yixun.qfbao.model.enums;

import org.apache.commons.lang.StringUtils;

public enum HousePurposeEnum {
	UNLIMITED("UNLIMITED", "不限"),
	RIGID_DEMAND("RIGID_DEMAND", "刚需"),
	IMPROVE("IMPROVE", "改善"),
	WEDDING_ROOM("WEDDING_ROOM", "婚房"),
	SCHOOL_ROOM("SCHOOL_ROOM", "教育"),
	INVESTMENT("INVESTMENT","投资"),
	;

	private String no;
	private String des;

	public String getNo() {
		return no;
	}

	public void setNo(String no) {
		this.no = no;
	}

	public String getDes() {
		return des;
	}

	public void setDes(String des) {
		this.des = des;
	}

	public void setDesc(String des) {
		this.des = des;
	}

	HousePurposeEnum(String no, String des) {
		this.no = no;
		this.des = des;
	}

	public static HousePurposeEnum getByNo(String no) {
		if (StringUtils.isBlank(no)) {
			return null;
		}
		for (HousePurposeEnum menum : values()) {
			if (menum.getNo().equals(no)) {
				return menum;
			}
		}
		return null;
	}

	public static String getNameByCode(String code) {
		if (!StringUtils.isEmpty(code)) {
			HousePurposeEnum anEnum = getByNo(code);
			if (anEnum != null) {
				return anEnum.getDes();
			} else {
				return null;
			}
		}
		return null;
	}

}
